export default {
  namespaced: true,
  state() {
    return {
      userInfo:JSON.parse(localStorage.getItem('userInfo') || '{}')
    }
  },
  mutations:{
    saveToken(state,val) {
      state.userInfo = val
      localStorage.setItem('userInfo', JSON.stringify(val))
    },
    clearToken(state) {
      state.userInfo = {}
      localStorage.setItem('userInfo', JSON.stringify({}))
    }
  }
}